import request from "@/utils/request";

// 新增
export function addGroupInfo(params) {
  return request({
    url: "/subitem",
    method: "POST",
    data: params || {}
  });
}

// 更新
export function updateGroupInfo(params) {
  return request({
    url: "/subitem",
    method: "PUT",
    data: params || {}
  });
}

// 删除
export function deleteGroupInfo(id) {
  return request({
    url: `/subitem/${id}`,
    method: "DELETE"
  });
}

//项目分项树
export function findProjectGroupTree() {
  return request({
    url: `/subitem/tree`,
    method: "GET",
  });
}
//分项树
export function findGroupTree(projectId) {
  return request({
    url: `/subitem/tree/${projectId}`,
    method: "GET",
  });
}
//分项绑定的计量器具信息
export function findGroupTree(subitemId) {
  return request({
    url: `/subitem/meter-utensils/${subitemId}`,
    method: "GET",
  });
}
//绑定计量器具
export function findGroupTree(params) {
  return request({
    url: `/subitem/meter-utensils`,
    method: "POST",
    data: params || {}
  });
}
//解绑计量器具
export function findGroupTree(id) {
  return request({
    url: `/subitem/meter-utensils/${id}`,
    method: "DELETE",
  });
}